{{!
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}}
<div class="form-inline">
  <select onchange={{action (mut condition.operator) value="target.value"}} name="select-input" class="form-control" data-show-icon="true">
    {{#each conditionsList as |condition index|}}
    <option value={{condition.value}} selected={{eq condition.operator condition.value}}>{{condition.displayName}}</option>
    {{/each}}
  </select>
  {{#if (not (eq condition.operator "combine"))}}
    <button id="data-add-btn" {{action 'addCondition'}} type="button" class="btn btn-default form-control">
    <i class="fa fa-plus-circle"></i>&nbsp;Condition</button>
  {{/if}}
  <button id="data-add-btn" {{action 'addDataInput'}} type="button" class="btn btn-default form-control">
    <i class="fa fa-plus-circle"></i>&nbsp;Data Input</button>
  {{#if showAdvanced}}
  {{input type="text" class="form-control" name="conditionName" title="Condition Name" value=condition.name placeholder="Condition Name"}}
  {{input type=text class="form-control" value=condition.min placeholder="Mininum Inputs"}}
  {{input type=text class="form-control" value=condition.wait placeholder="Wait Time"}}
  <button id="data-add-btn" {{action 'hideAdvanced'}} type="button" title="Configure Advanced Options" class="form-control btn btn-default">
    <i class="fa fa-chevron-left"></i>&nbsp;Advanced
  </button>
  {{else}}
  <button id="data-add-btn" {{action 'showAdvanced'}} type="button" title="Configure Advanced Options" class="form-control btn btn-default">
    <i class="fa fa-chevron-right"></i>&nbsp;Advanced
  </button>
  {{/if}}
  {{yield}}
  {{field-error model=this field='condition.operator' showErrorMessage=showErrorMessage}}
  {{field-error model=this field='condition.operands' showErrorMessage=showErrorMessage}}
</div>
<ul class="list-group">
  {{#each condition.operands as |operand index|}}
  <li class="list-group-item">
    {{#if (eq operand.type 'condition') }}
    {{#conditional-data-input condition=operand datasets=datasets}}
    <span class="pull-right">
      <i class="fa fa-trash-o" title="Delete" {{action "deleteOperand" index bubbles=false}}></i>
    </span>
    {{/conditional-data-input}}
    {{else}}
      {{#data-input datasets=datasets dataInput=operand register="registerChild" deregister="deregisterChild"}}
      <span class="pull-right">
        <i class="fa fa-trash-o" title="Delete" {{action "deleteOperand" index bubbles=false}}></i>
      </span>
      {{/data-input}}
    {{/if}}
  </li>
  {{/each}}
</ul>
